<?php
require_once("../../model/invoice.php");

$obj_invoice = new Invoice();

// $msg = $obj_invoice->check_exists_invoice("HHD256");
// echo $msg; exit();

$data = $obj_invoice->get_list_invoice();
echo "<table class=\"table table-striped list-invoice\">";
echo "<thead>";
    echo "<th>Mã hóa đơn</th>";
    echo "<th>Tên khách hàng</th>";
    echo "<th>Email</th>";
    echo "<th>Địa chỉ</th>";
    echo "<th>Tổng tiền</th>";
    echo "<th>Tác vụ</th>";
echo "</thead>";
foreach($data as $key=>$value)
{
    echo "<tr class=\"invoice-{$value['invoice_id']}\">";
        $invoice_id = $value['invoice_id'];
        echo "<td>".$value['invoice_id']."</td>";
        echo "<td>".$value['user_name']."</td>";
        echo "<td>".$value['email']."</td>";
        echo "<td>".$value['address']."</td>";
        echo "<td>".$value['sum_total']."</td>";
        echo "<td><a href='javascript:void(0)' onclick=\"del_invoice_by_id('$invoice_id')\">Delete</a></td>";
    echo "</tr>";
}
echo "</table>";